using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	[Serializable()]
    [XmlType(TypeName = "TimeSpanType")]
    public class TimeSpan : TimePrimitive
	{
        private string beginField, endField;

        [XmlElement(ElementName = "begin", DataType = "string")]
        public string Begin
        {
            get { return this.beginField; }
            set { this.beginField = value; }
        }

        [XmlElement(ElementName = "end", DataType = "string")]
        public string End
        {
            get { return this.endField; }
            set { this.endField = value; }
        }

        public DateTime BeginDate
        {
            get { return System.Xml.XmlConvert.ToDateTime(this.beginField, System.Xml.XmlDateTimeSerializationMode.Utc); }
            set { this.beginField = System.Xml.XmlConvert.ToString(value, System.Xml.XmlDateTimeSerializationMode.Utc); }
        }

        public DateTime EndDate
        {
            get { return System.Xml.XmlConvert.ToDateTime(this.endField, System.Xml.XmlDateTimeSerializationMode.Utc); }
            set { this.endField = System.Xml.XmlConvert.ToString(value, System.Xml.XmlDateTimeSerializationMode.Utc); }
        }
    }
}